package com.read.util;

import com.read.common.response.RespEnum;
import com.read.common.response.RespResult;

/**
 * @author sh-sunb6
 * @description 统一返回工具类
 * @date 2019-02-20 9:57
 */
public class RespUtil {

    public static RespResult success(Object data) {
        RespResult rr = new RespResult();
        rr.setCode(RespEnum.SUCCESS.getCode());
        rr.setMsg(RespEnum.SUCCESS.getMsg());
        rr.setData(data);
        return rr;
    }

    public static RespResult success() {
        return success(null);
    }

    public static RespResult error(RespEnum re) {
        RespResult rr = new RespResult();
        rr.setCode(re.getCode());
        rr.setMsg(re.getMsg());
        return rr;
    }

}
